#include<stack>
#include<iostream>
#include<utility>
using std::pair;
using std::stack;



class StockSpanner {
public:
    stack<pair<int, int>> maxStack;
    int i;
    StockSpanner() {
        i = -1;
    }
    
    int next(int price) {
        i++;
        std::cout << "\n" << i << " Iteration\n";
        std::cout << "maxStack status: ";
        if (maxStack.empty()) std::cout << "Empty\n";
        else std::cout << "(" << maxStack.top().first << ", " << maxStack.top().second << ")\n";
        if (i == 0 || price < maxStack.top().second) {
            maxStack.push(std::make_pair(i, price));
            return 1;
        }
        while (!maxStack.empty() && price >= maxStack.top().second) maxStack.pop();
        int lastInd = maxStack.empty() ? -1 : maxStack.top().first;
        maxStack.push(std::make_pair(i, price));
        return i - lastInd;
    }

    
};

/**
 * Your StockSpanner object will be instantiated and called as such:
 * StockSpanner* obj = new StockSpanner();
 * int param_1 = obj->next(price);
 */

int main() {
    int price;
    StockSpanner span;
    while (std::cin >> price) {
        int ans = span.next(price);
        std::cout << "Price " << price << "  ans: " << ans << "\n";
    }
    return 0;
}